function waimai(n, x, y, z, f) {
    //折扣
    var arr = []
    var sum = 0
    for (let i = 1; i < n; i++) {
        arr.push(sum += y[i])
    }
    //满减
    var arr1 = []
    var sum1 = h[0]
    for (let j = 1; j < n; j++) {
        for (let g = z[z.length - 1]; g > 0; g--) {
            sum1 += h[j]
            if (sum1 > z[f]) {
                arr1.push(sum1 -= f[g])
                break
            }
        }
    }
    //判断
    for (let h = 0; h < arr.length; h++) {
        if (h = 0) console.log('B');
        if (h != 0) {
            if (arr[h] == arr1[h]) {
                console.log('B');
            }
            if (arr[h] > arr1[h]) {
                console.log('Z');
            }
            if (arr[h] < arr1[h]) {
                console.log('M');
            }
        }
    }
}